#ifndef FUSEVM_DATA
#define FUSEVM_DATA

#include <string>

#include "types.h"
#include "fileNode.h"

class FuseVMData
{
private:
    FileNode *m_root;
    filemap_t files;
    FileNode *findParent(const FileNode *node) const;
    void attachNode(int64_t id, int type, const char *name);
    void connectNodeToTree(FileNode *node);

public:
    std::string m_cwd;
    FuseVMData(const char *cwd);
    ~FuseVMData();
    FileNode *find(const char *fname) const;
    char *get_name(std::string full_name);
    int removeNode(FileNode *node);
    void build_tree();
    void insertNode (FileNode *node);
    void renameNode (FileNode *node, const char *newName, bool reparent);
    size_t numFiles() const
    {
        return files.size() - 1;
    }
};
#endif